package com.rd.student.ruanjian.class1.duhang.Week04.New;

import java.util.concurrent.ArrayBlockingQueue;

public class Cook01 extends Thread{

    ArrayBlockingQueue<String>queue;

    public Cook01(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true){
            //不断把东西放入阻塞队列当中
            try {
                queue.put("东西");
                System.out.println("生产了一个东西");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
